home *** CD-ROM | disk | FTP | other *** search
/ Megadoom II / MEGADOOM II - iso.7z / MEGADOOM II.ISO / doom / editors / map / dmpsmu / source / dmps.h next >
C/C++ Source or Header  |  1994-10-25  |  5KB  |  190 lines

  1. /*
  2.    DooM PostScript Maps Utility, by Frans P. de Vries.
  3.  
  4. Derived from:
  5.  
  6.    Doom Editor Utility, by Brendon Wyber and Raphaδl Quinet.
  7.  
  8.    You are allowed to use any parts of this code in another program, as
  9.    long as you give credits to the authors in the documentation and in
  10.    the program itself.  Read the file README for more information.
  11.  
  12.    This program comes with absolutely no warranty.
  13.  
  14.    DMPS.H - Main DMPSMU and DMPSMAP defines.
  15. */
  16.  
  17.  
  18. /* the includes */
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <stdarg.h>
  22. #include <string.h>
  23. #include <ctype.h>
  24.  
  25.  
  26. /* global definitions */
  27. #define DMPS_VERSION    "2.0"
  28. #define DEU_VERSION    "5.21 GCC" /* DJGPP/GO32 version */
  29. typedef short int        BCINT;
  30. typedef unsigned short int    UBCINT;
  31.  
  32. #include "dmunix.h"
  33.  
  34.  
  35. /*
  36.    syntactic sugar
  37. */
  38. typedef BCINT Bool;    /* Boolean data: true or false */
  39.  
  40. /* boolean constants */
  41. #ifndef TRUE
  42. #define TRUE        1
  43. #define FALSE        0
  44. #endif
  45.  
  46.  
  47. /*
  48.    The directory structure is the structure used by DOOM to order the
  49.    data in its WAD files.
  50. */
  51. typedef struct Directory huge *DirPtr;
  52. struct Directory
  53. {
  54.    long start;        /* offset to start of data */
  55.    long size;        /* byte size of data */
  56.    char name[ 8];    /* name of data block */
  57. };
  58.  
  59.  
  60. /*
  61.    The Wad file pointer structure is used for holding the information
  62.    on the Wad files in a linked list.
  63.    The first Wad file is the main WAD file. The rest are patches.
  64. */
  65. typedef struct WadFileInfo huge *WadPtr;
  66. struct WadFileInfo
  67. {
  68.    WadPtr next;        /* next file in linked list */
  69.    char   *filename;    /* name of the WAD file */
  70.    FILE   *fileinfo;    /* C file stream information */
  71.    char   type[ 4];    /* type of WAD file (IWAD or PWAD) */
  72.    long   dirsize;    /* directory size of WAD */
  73.    long   dirstart;    /* offset to start of directory */
  74.    DirPtr directory;    /* array of directory information */
  75. };
  76.  
  77.  
  78. /*
  79.    The master directory structure is used to build a complete directory
  80.    of all the data blocks from all the various Wad files.
  81. */
  82. typedef struct MasterDirectory huge *MDirPtr;
  83. struct MasterDirectory
  84. {
  85.    MDirPtr next;    /* next in list */
  86.    WadPtr  wadfile;    /* file of origin */
  87.    struct Directory dir;/* directory data */
  88. };
  89.  
  90.  
  91. /*
  92.    Description of the command line arguments and config file keywords.
  93. */
  94. typedef struct
  95. {
  96.    char *short_name;    /* abbreviated command line argument */
  97.    char *long_name;    /* command line arg. or keyword */
  98.    enum    {        /* type of this option */
  99.       OPT_BOOLEAN,    /* boolean (toggle) */
  100.       OPT_INTEGER,    /* integer number */
  101.       OPT_STRING,    /* character string */
  102.       OPT_STRINGACC,    /* character string, but store in a list */
  103.       OPT_STRINGLIST,    /* list of character strings */
  104.       OPT_END        /* end of the options description */
  105.       }  opt_type;
  106.    char *msg_if_true;    /* message printed if option is true */
  107.    char *msg_if_false;    /* message printed if option is false */
  108.    void *data_ptr;    /* pointer to the data */
  109. } OptDesc;
  110.  
  111.  
  112. /*
  113.    the interfile global variables
  114. */
  115.  
  116. /* from dmpsmu.c/dmpsmap.c */
  117. extern Bool  Registered;    /* registered or shareware WAD file? */
  118. extern Bool  Commercial;    /* DOOM ][ or DOOM WAD file? */
  119. extern char *MainWad;        /* name of the main WAD file */
  120. extern char *UserLvlNm;        /* user defined level name */
  121.  
  122. /* from wads.c */
  123. extern WadPtr  WadFileList;    /* linked list of Wad files */
  124. extern MDirPtr MasterDir;    /* the master directory */
  125.  
  126. /* from ps.c */
  127. extern FILE *PSFile;        /* the PostScript output file */
  128.  
  129.  
  130. /*
  131.    the function prototypes
  132. */
  133.  
  134. /* from dmpsmu.c/dmpsmap.c */
  135. int main( int, char *[]);
  136. void ParseCommandLineOptions( int, char *[]);
  137. void Usage( FILE *);
  138. void Credits( FILE *);
  139. void ProgError( char *, ...);
  140. void MainLoop( void);
  141.  
  142. /* from wads.c */
  143. void OpenMainWad( char *);
  144. void OpenPatchWad( char *);
  145. void CloseWadFiles( void);
  146. void CloseUnusedWadFiles( void);
  147. WadPtr BasicWadOpen( char *);
  148. void BasicWadRead( WadPtr, void huge *, long);
  149. void BasicWadSeek( WadPtr, long);
  150. MDirPtr FindMasterDir( MDirPtr, char *);
  151. void ListMasterDirectory( FILE *);
  152. void ListFileDirectory( FILE *, WadPtr);
  153. void CopyBytes( FILE *, FILE *, long);
  154. Bool Exists( char *);
  155. void DumpDirectoryEntry( FILE *, char *);
  156. void SaveEntryToRawFile( FILE *, char *);
  157.  
  158. /* from things.c */
  159. BCINT GetThingClass( BCINT);
  160. BCINT GetThingRadius( BCINT);
  161.  
  162. /* from levels.c */
  163. void ReadLevelData( BCINT, BCINT);
  164. void ForgetLevelData( void);
  165.  
  166. /* from print.c */
  167. void PrintLevel( BCINT, BCINT);
  168. void PrintMap( void);
  169. BCINT FindTeleExit( BCINT);
  170. void DisplayFlags( void);
  171. void SetFlag( char, char);
  172. void AnalyzeLevel( BCINT, BCINT);
  173.  
  174. /* from ps.c */
  175. void InitPage( BCINT, BCINT, char *);
  176. void InitScale( BCINT, BCINT, char *);
  177. Bool CheckScale( BCINT, BCINT);
  178. void AdjustScale( BCINT, BCINT);
  179. void InitLines( void);
  180. void InitThings( void);
  181. void InitShades( void);
  182. void InitLinks( void);
  183. void TermPage( void);
  184. void PrintMapLine( BCINT, BCINT, BCINT, BCINT, Bool, Bool);
  185. void PrintMapThing( BCINT, BCINT, BCINT, BCINT, BCINT);
  186. void PrintTeleLink( BCINT, BCINT, BCINT, BCINT);
  187. void PrintShade( char, BCINT, BCINT);
  188.  
  189. /* end of file */
  190.